package com.google.code.opengw.http;

import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;

public class HTTPConstants {
	public static final String HTTP_PROTOCOL = "HTTP/1.1";
	
	public static final int CODE_200 = 200;
	public static final String CODE_200_DETAIL = "OK";
	
	public static final int CODE_300 = 300;
	public static final int CODE_301 = 301;
	public static final int CODE_302 = 302;
	public static final int CODE_303 = 303;
	public static final int CODE_304 = 304;
	public static final int CODE_305 = 305;
	public static final int CODE_307 = 307;
	public static final int CODE_400 = 400;
	public static final int CODE_401 = 401;
	public static final int CODE_402 = 402;
	public static final int CODE_403 = 403;
	public static final int CODE_404 = 404;
	public static final int CODE_405 = 405;
	public static final int CODE_406 = 406;
	public static final int CODE_407 = 407;
	public static final int CODE_408 = 408;
	public static final int CODE_409 = 409;
	public static final int CODE_410 = 410;
	public static final int CODE_411 = 411;
	public static final int CODE_412 = 412;
	public static final int CODE_413 = 413;
	public static final int CODE_414 = 414;
	public static final int CODE_415 = 415;
	public static final int CODE_416 = 416;
	public static final int CODE_417 = 417;
	public static final int CODE_500 = 500;
	public static final int CODE_501 = 501;
	public static final int CODE_502 = 502;
	public static final int CODE_503 = 503;
	public static final int CODE_504 = 504;
	public static final int CODE_505 = 505;
	
	private static Map<String, String> httpMessages = new HashMap<String, String>();
	
	public static final String HTTP_ERROR_PAGE_HTML;
	
	static {
		ResourceBundle bundle = ResourceBundle.getBundle("com.google.code.opengw.http.resources");
		HTTP_ERROR_PAGE_HTML = bundle.getString("html");
		Set<String> keySet = bundle.keySet();
		for(String key : keySet){
			if(key.equals("html"))
				continue;
			else{
				httpMessages.put(key, bundle.getString(key));
			}
		}
	}
	
	public static String getHTTPCodeMessage(String httpCode){
		return httpMessages.get(httpCode);
	}
	
}
